from sanic import Blueprint
from sanic import response
from jinja2 import Environment  
from jinja2 import PackageLoader


env = Environment(loader=PackageLoader('page', 'templates'))
# 和vue的模板插值标记重复，修改为带空格的
env.variable_start_string = '{{ '
env.variable_end_string = ' }}'

page = Blueprint('my_page_v1', url_prefix='/page')

@page.route("/webColor")
async def webColorView(request):
    template = env.get_template('WebColor.html')
    content = template.render()
    return response.html(content)

@page.route("/tools")
async def toolsView(request):
    template = env.get_template('tools.html')
    content = template.render()
    return response.html(content)

@page.route("/filter")
async def filterView(request):
    template = env.get_template('filter.html')
    content = template.render()
    return response.html(content)

@page.route("/download")
async def downloadView(request):
    template = env.get_template('Download.html')
    content = template.render()
    return response.html(content)

